All Questions
Tagged with python-xarraygeopandas
30 questions
0votes
0answers
43views
Python stacking multidimensional arrays from geotiff, grabbing index of max value of each pixel across stacks
I am fairly new to GeoSpatial coding and coding in general. I have roughly 100 geotiff files of the same region. I'd like to index each stack with the datetime, go pixel by pixel and solve for the max ...
0votes
0answers
43views
Perform operation in-place with xarray
I am going crazy over the following issue: I want to map values from an xarray data array. Since I am constrained on memory, I want to do that in-place, but it just won't work! The code works fine ...
0votes
0answers
24views
Converting output of cf_xarray to an xarray Dataset with "lat", "lon", "time" dimensions
You can find below the code I have used to convert a shapefile to an xarray dataset using cf_xarray library. What I want to achieve now is having an xarray Dataset with dimensions "lat", &...
0votes
1answer
365views
xArray + geopandas + iterate through each polygon and get basic statistics
I come to the community to ask help for some issues regarding xarrary + geopandas for time series data analysis. I have a xarray dataset called cum_magn_ds that looks like this: xarray.Dataset ...
1vote
0answers
241views
How to crop an xarray Dataset using a Shapefile with non-standard grid coordinates
I have a netCDF dataset with dimensions represented by 'xc' and 'yc', which are in meters, and the CRS of the dataset is Lambert Azimuthal Equal Area projection with the following parameters: Grid ...
0votes
0answers
58views
Remove white spaces in subplots matplolib
I try to plot the subplots as shown below. It works okay but it still have some white spaces at the end of figure. Is it possible remove white spaces. Any help would be very great. Here is the code ...
0votes
1answer
125views
iterate over features to mask a raster file
I have a raster layer and a shapefile with multiple polygons. I want to iterate over the features (polygons) to mask the raster layer and then get some statistic for each masked features. However, I ...
0votes
1answer
197views
Fixing Incorrect Overlay of Self-Made Raster and Shapefile
I'm creating rasters of Rio Grande do Sul, Brazil for part of a project I'm working on. They are successfully produced and everything looks good except for when I plot one on the same axis as a ...
1vote
1answer
389views
Filter xarray ZARR dataset with GeoDataFrame
I am reading a ZARR file from a s3 bucket with xarray. I got to successfully filter by time and latitude/longitude: def read_zarr(self, dataset: str, region: Region) -> Any: # Read ZARR ...
0votes
0answers
138views
Code review: add columns to geopandas geodataframe based on sums of xarray dataset values, filtered by geoseries geometry
Edit: Solved it Turns out I just needed to find geocube, a wonderful library for zonal statistics. That tutorial provides a great example for analysis on a DataArray; here's my code for analysis on ...
0votes
1answer
629views
Clipping a NetCDF file with rioxarray, problems with sizing
I have been trying to clip a global precipitation NetCDF file using a shape file of a basin I have. This is the code: import geopandas as gpd import rioxarray import xarray as xr import matplotlib....
0votes
1answer
119views
Count (or sum) the number of the gridpoints from a high resultion 2-D data, that are closest to the nearst gridpoints of a 2-D coarse resolution?
I have two datasets, the first one is a high spatial resolution, and its values are 0 and 1, and the second dataset has coarse spatial resolution data (its values are not important in my case). I ...
0votes
0answers
94views
Clip NetCDF with Shapefile
I have followed a few solutions found on StackOverflow and the GIS StackExchange, but cannot seem to troubleshoot this error message. I don't have a lot of experience working with GeoPandas, so any ...
2votes
0answers
729views
How can I get country data from a NC (NetCDF) file containing global data in the form of longitudes and latitude?
I have a temperature data from a NetCDF file from NASA's website for global level. The data is in this link in my google drive. I am able to open the data using: from netCDF4 import Dataset data = ...
1vote
1answer
1kviews
xarray - MissingSpatialDimensionError (assign coordinates as dimensions)
A have a netCDF file that I opened with xarray. I want to clip the xarray data set using a shapefile; however, I cannot figure out how to properly set my spatial dimensions. I have the following data ...